home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-03-16 | 2.2 KB | 61 lines | [TEXT/KAHL] |
- // AESubDescs.h
- //
- // A high-efficiency way to examine AEDescs. Everything is done in place, without any
- // copying of data, which avoids most of the overhead of the Apple Event Manager.
- //
- // By Jens Alfke; Copyright ©1992 Apple Computer. All Rights Reserved.
-
-
- #pragma once /* For THINK C users */
- #ifndef __AESUBDESCS__
- #define __AESUBDESCS__ /* For poor MPW users :) */
-
- #include <AppleEvents.h>
-
- enum{ // Error code
- errAEListIsFactored = -1760 // I cannot get data from factored lists
- };
-
-
- typedef struct {
- DescType subDescType; // Type of this subDesc. You may read this field.
- Handle dataHandle; // Handle to main (outer) descriptor. Private.
- long offset; // Offset into main descriptor where subDesc starts. Private.
- } AESubDesc;
-
-
- pascal void
- AEDescToSubDesc( const AEDesc*, AESubDesc* ); // Create subDesc on desc
- pascal OSErr
- AESubDescToDesc( const AESubDesc*, long desiredType, AEDesc* ); // Copy subDesc to new desc
-
- pascal DescType
- AEGetSubDescType( const AESubDesc* ); // Same as ->subDescType
- pascal void*
- AEGetSubDescData( const AESubDesc*, long *length ); // Invalid once dataHandle moves
-
- // Use AEGetSubDescBasicType to see if a descriptor is a coerced record. If it is, the result
- // type will be typeAERecord ('reco'). Otherwise it will be the same as the regular subDescType.
- // This call allocates memory; an error may be returned if there wasn't enough free.
-
- pascal OSErr
- AEGetSubDescBasicType( const AESubDesc*, DescType* basicType );
-
- // The list-oriented calls that follow make no attempt to check whether the input SubDesc really
- // is a list or a record.
- // This lets the you directly access coerced records, but you will probably die in a big way
- // if the descriptor isn't a record at all. Call AEGetSubDescBasicType beforehand (and see if
- // the basic type is typeAEList or typeAERecord) if you're cautious.
-
- pascal long
- AECountSubDescItems( const AESubDesc* );
-
- // In these next two calls, it's okay if newSD == sd; sd will be overwritten with the new subDesc.
-
- pascal OSErr
- AEGetNthSubDesc( const AESubDesc* sd, long index,
- AEKeyword* keyIfAny, AESubDesc* newSD ),
- AEGetKeySubDesc( const AESubDesc* sd, AEKeyword,
- AESubDesc* newSD );
-
- #endif